<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>工艺详情</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/layui.css"  media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/toastr.min.css"  media="all">

<style type="text/css">
.laytable-cell-1-imageUrl{
	height:100%;
	max-width:100%;
}
</style>

</head>
<body>
<!-- 页面顶部搜索框 -->
<br>
<div class="layui-form" id="selectform">
	<table>
		<tr>
			<td>
				<div class="layui-input-block" style="width: 200px; margin-left: 500px;">
					<select id="productNumber" name="productNumber" placeholder="请选择工艺名称" lay-filter="productNumber" class="layui-select" lay-verify="productNumber">
						<option value="">请选择工艺名称</option>
					</select>
				</div>
			</td>
			<td>
				<div style="margin-left: 20px;">
					<select id="engineeringEnum" name="engineeringEnum" placeholder="请选择版本号" lay-filter="engineeringEnum" class="layui-select" lay-verify="engineeringEnum">
						<option value="">请选择版本号</option>
					</select>
				</div>
			</td>
			<td><button class="layui-btn layui-btn-blue" onclick="selectData()" style="margin: 0 0 0 10px; margin-left: 20px" data-type="reload"><i class="layui-icon layui-icon-search">搜索</i></button></td>
			<td><a class="layui-btn layui-btn-blue" href="javascript:history.back(-1)" style="margin: 0 0 0 10px; margin-left: 20px" data-type="reload">返回</a></td>
		</tr>
	</table>
</div>

<!-- 详情数据 -->
<div id="detail"></div>

<script src="${pageContext.request.contextPath }/assets/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/assets/layui.all.js"></script>
<script src="${pageContext.request.contextPath }/assets/js/jquery.min.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/assets/js/toastr.min.js" charset="utf-8"></script>

<script>

var layedit = null;
layui.use(['table','layer','upload','form', 'layedit'], function(){
	var laydate = layui.laydate;
	var table = layui.table;
	var layer = layui.layer;
	var upload = layui.upload;
    var form = layui.form;
    layedit = layui.layedit;
    
    $.ajax({
        type: "post",
        url: "${pageContext.request.contextPath }/technicsMana/listAll.do",
        dataType: 'JSON',
        async: false,
        success: function (datas) {
        	//设置下拉列表中的值的属性
              for ( var i = 0; i < datas.length; i++) {
             	 //增加下拉列表。
              	$("#productNumber").append("<option value='"+datas[i].tname+"'>"+datas[i].tname+"</option>");
			}
        }
  	});
	form.on('select(productNumber)', function(data){
	    $("#engineeringEnum").find("option").not(":first").remove();
		$.ajax({
		   	type:'post',
		   	url:'${pageContext.request.contextPath }/technicsMana/getTechnicsByName.do',
		   	data:{"tname":data.value},
		    dataType: 'JSON',
		   	success:function(datas){
		   		//设置下拉列表中的值的属性
	            for ( var i = 0; i < datas.length; i++) {
	            	//增加下拉列表。
	              	$("#engineeringEnum").append("<option value='"+datas[i].remark01+"'>"+datas[i].remark01+"</option>");
				}
	            form.render();
		   	}
		})
	});
	form.render();
	
});

toastr.options.positionClass = 'toast-top-center'; //提示框的位置设置为中上

 function selectData(){
	var productNumber = $('#productNumber').val();
	var num = $('#engineeringEnum').val();
	$.ajax({
	   	type:'post',
	   	url:'${pageContext.request.contextPath }/refrenceMana/getReferenceByNameAndNum.do',
	   	data:{"productNumber":productNumber, "engineeringEnum":num},
	   	success:function(data){
	   		$('#detail').html(data);
	   	}
	})
} 
</script>
</body>
</html>